<template>
	<view class="add">
		<view class="add_item">
			<view>编号</view>
			<input type="text" value="" placeholder="请输入编号"/>
		</view>
		<view class="add_item">
			<view>类型</view>
			<picker mode="selector" :range="laber" @change="getLaber" class="add_picker">
				<text>{{laber[laberIndex]}}</text>
				<image src="/static/images/right.png" class="right"></image>
			</picker>
		</view>
		<view class="add_item">
			<view>客户名称</view>
			<input type="text" value="" placeholder="请输入客户名称"/>
		</view>
		<view class="add_item">
			<view>联系人</view>
			<input type="text" value="" placeholder="请输入联系人"/>
		</view>
		
		<Time :fields="'day'" :lang="false" :inputName="'预约时间'" @getDate="getStartDate"></Time>
		
		<view class="add_item">
			<view>客户地址</view>
			<input type="text" value="" placeholder="请输入客户地址"/>
		</view>
		<view class="add_twig"></view>
		<view class="add_item">
			<view>主负责人</view>
			<picker mode="selector" :range="user1" @change="getUser" class="add_picker" :data-index="1">
				<text>{{user1[userIndex1]}}</text>
				<image src="/static/images/right.png" class="right"></image>
			</picker>
		</view>
		<view class="add_item">
			<view>副执行人</view>
			<picker mode="selector" :range="user2" @change="getUser" class="add_picker" :data-index="2">
				<text>{{user2[userIndex2]}}</text>
				<image src="/static/images/right.png" class="right"></image>
			</picker>
		</view>
		
		<view class="add_textarea">
			<view>内容</view>
			<textarea value="" placeholder="请输入内容" />
		</view>
		
		<view class="save">提交</view>
	</view>
</template>

<script>
	import Time from "../../../../components/time/time.vue"
	export default{
		components:{
			Time
		},
		data(){
			return{
				laber:["白切鸡","酱油鸡"],
				user1:["张三","李四","王五"],
				user2:["张三","李四","王五"],
				laberIndex:0,
				userIndex1:0,
				userIndex2:0,
				upJson:{
					"work_order_num":"MDAwMDAwMDAwMLGFbqE",//加密的id
					"category_id":"MDAwMDAwMDAwMLGFbqE",
					"merchant_id":"MDAwMDAwMDAwMLGFbqE",
					"appointment":"",//预约时间.时间戳
					"fee":"",//工单费用,可为0
					"goods_desc":"",//工单所需商品描述,可为空
					"content":"",//派工内容,可为空
					"department_id":"MDAwMDAwMDAwMLGFbqE",//部门id
					"executive":"MDAwMDAwMDAwMLGFbqE",//执行人
					"deputy":"MDAwMDAwMDAwMLGFbqE",//副手
					"salesman":"MDAwMDAwMDAwMLGFbqE",//业务员
					"visitor":"MDAwMDAwMDAwMLGFbqE"//回访人
				}
			}
		},
		onLoad(options) {
			this.$api.getClientWorkClassify({merchantId:options.merchantId}).then(res => {
				this.laber = res.categoryList;
				let list = [];
				for(let i in res.userList){
					for(let j in res.userList[i].user){
						list.push(res.userList[i].user[j])
					}
				}
				this.upJson.afterSaleConnect = list[0].username;
				this.upJson.businessConnect = list[0].username;
				this.upJson.category = res.categoryList[0].merchantCateId;
				this.typeName = res.categoryList[0].name;
				this.userList = list;
				this.typeList = res.categoryList;
			})
		},
		methods:{
			getStartDate(e){
				
			}
		}
	}
</script>

<style>
	.add{width: 100%;background: #FFFFFF;padding-bottom: 50upx;}
</style>
